/**
 * Created by Administrator on 2017/5/25.
 */
"use strict";
//引入模块
const mongoose = require('mongoose');
const db = require('./db');

// Schema 结构
var AriafansnumSchema = new mongoose.Schema({
    afsid      :{type:Number,index: true},//afsid
    bid     :{type:Number,index: true},//书id
    uid     :{type:Number,index: true},//用户id
    reward    :{type : Number},//打赏
    time  :{type : Number,default:new Date().getTime()}//时间
});

AriafansnumSchema.statics.findFn = function(obj,obj1, callback) {
    return this.model('Ariafansnum').find(obj, callback).sort(obj1);
};
AriafansnumSchema.statics.findFnLimit = function(obj,obj1,num1,callback) {
    return this.model('Ariafansnum').find(obj).sort(obj1).limit(num1).exec(callback);
};
AriafansnumSchema.statics.findSortOne = function(obj,obj1,callback) {
    return this.model('Ariafansnum').findOne(obj).sort(obj1).exec(callback);
};
AriafansnumSchema.statics.sumFn = function(obj,callback) {
    return this.model('Ariafansnum').aggregate(obj).exec(callback);
};

var AriafansnumModel = db.model('Ariafansnum', AriafansnumSchema);

module.exports=AriafansnumModel;